package org.jeecg.modules.bigdatashow.mapper;

import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.bigdatashow.entity.*;

import java.util.List;

public interface ScenicMapper {
    @Select("select * from employee")
    List<Employee> findAllEmploy();

    @Select(" select COUNT(departmentId) from employee where departmentId = #{departmentId} ")
    Integer findDepartmentNumber(Integer departmentId);

    @Select("select * from department")
    List<Department> findAllDepartment();

    @Select("select * from scenicWorker order by monthId")
    List<ScenicWorker> findWorker();

    @Select("select departmentId , COUNT(departmentId) as allWorker from employee group by departmentId having COUNT(departmentId) > 1 order by COUNT(departmentId) desc limit 1")
    List<Department2> findMaxDe();

    @Select("select name from department where id = #{departmentId} ")
    String findDepartmentById(Integer departmentId);

    @Select("select departmentId , COUNT(departmentId) as allWorker from employee group by departmentId having COUNT(departmentId) >= 1 order by COUNT(departmentId) limit 1 ")
    List<Department2> findMin();

    @Select("select time , departmentId  from logtb where result = 0 limit  1")
    List<LogTb> findLog();

    @Select("select name from employee where id = (select employId from department where id = #{departmentId})")
    String findLeaderName(Integer departmentId);

    @Select("select workerNum from scenicworker ")
    List<Integer> findPorp();

}
